package app;


class SymbolicValue extends AttributeValue {
	private int intValue;
	private String stringValue;
	
	public SymbolicValue(int value, String stringValue) {
		if (value < 0)
			throw new IllegalArgumentException("Value must be positive");
		
		this.intValue = value;
		this.stringValue = stringValue;
	}
	
	public SymbolicValue(String stringValue) {
		this.intValue = -1;
		this.stringValue = stringValue;
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
		
		if (!(o instanceof SymbolicValue))
			return false;
		
		return ((SymbolicValue) o).hashCode() == intValue;
	}
	
	public String getStringValue() {
		return stringValue;
	}
	
	public int hashCode() {
		return intValue;
	}

	public String toString() {
		return stringValue;
	}
}